[ImgBot] Optimize images#7
Open
imgbot[bot] wants to merge 6 commits into
Open
Conversation
Comment on lines
+9
to
+42
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 9 | ||
| run_install: false | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'pnpm' | ||
|
|
||
| - name: Setup Bun | ||
| uses: oven-sh/setup-bun@v1 | ||
| with: | ||
| bun-version: latest | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Setup headless environment | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y xvfb libasound2-dev libgtk-3-dev libnss3-dev | ||
|
|
||
| - name: Run tests | ||
| run: | | ||
| xvfb-run -a pnpm test |
|
|
||
| normalizeQuotes(value) { | ||
| if (this.quoteStyle === 'double' && value[0] === "'") { | ||
| const inner = value.slice(1, -1).replace(/"/g, '\\"').replace(/\\'/g, "'"); |
| const inner = value.slice(1, -1).replace(/"/g, '\\"').replace(/\\'/g, "'"); | ||
| return `"${inner}"`; | ||
| } else if (this.quoteStyle === 'single' && value[0] === '"') { | ||
| const inner = value.slice(1, -1).replace(/'/g, "\\'").replace(/\\"/g, '"'); |
| @@ -0,0 +1,367 @@ | |||
| import * as vscode from 'vscode'; | |||
| import { ALL_CALLABLE, FUNCTION_REGISTRY } from './functions'; | |||
| @@ -0,0 +1,201 @@ | |||
| import * as vscode from 'vscode'; | |||
| import { FormulaFormatter, PresetName, getPresetNames, LEGACY_STYLE_MAP } from '../vendor/shared'; | |||
| @@ -0,0 +1,495 @@ | |||
| const fs = require('fs'); | |||
| @@ -0,0 +1,495 @@ | |||
| const fs = require('fs'); | |||
| const path = require('path'); | |||
|
|
||
| printCall(node, indent) { | ||
| const name = node.name.toUpperCase(); | ||
| const args = node.args || []; |
| @@ -0,0 +1,775 @@ | |||
| const fs = require('fs'); | |||
| @@ -0,0 +1,775 @@ | |||
| const fs = require('fs'); | |||
| const path = require('path'); | |||
|
|
||
| import { FormulaFormatterConfig, DEFAULT_CONFIG, mergeConfig } from './config'; | ||
| import { PresetName, getPreset, fromLegacyStyle } from './presets'; | ||
| import { validateConfig, assertValidConfig } from './validate'; |
| // === CODE GENERATOR === | ||
|
|
||
| private generate(node: ASTNode, depth: number): string { | ||
| const indent = this.getIndent(depth); |
|
|
||
| private generate(node: ASTNode, depth: number): string { | ||
| const indent = this.getIndent(depth); | ||
| const nextIndent = this.getIndent(depth + 1); |
Comment on lines
+169
to
+179
| i++; | ||
| } | ||
|
|
||
| let j = i; | ||
| while (j < formula.length && WHITESPACE_RE.test(formula[j])) j++; | ||
|
|
||
| tokens.push({ | ||
| type: j < formula.length && formula[j] === '(' ? 'FUNCTION' : 'IDENTIFIER', | ||
| value: name | ||
| }); | ||
| } |
There was a problem hiding this comment.
Bug: The tokenizer in formula-minifier.js enters an infinite loop when it encounters an unrecognized character because the loop counter i is not incremented, causing the process to hang.
Severity: HIGH
Suggested Fix
Add a fallback case to the main tokenizer loop in formula-minifier.js. If no other token type matches, the loop should increment the index i to advance past the unrecognized character and continue tokenizing. This prevents the infinite loop. A similar implementation with an else { i++; } block already exists in formula-beautifier-v2.js.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: src/vendor/formula-minifier.js#L166-L179
Potential issue: The tokenizer in `formula-minifier.js` does not handle characters that
are not part of a recognized token type, such as `@`, `%`, or `~`. When such a character
is encountered, the main tokenizer loop fails to increment its index `i`. This results
in an infinite loop, causing the minification process to hang indefinitely. Because no
error is thrown, the `try-catch` block in the extension cannot prevent the application
from becoming unresponsive. This can be triggered by users pasting formulas that contain
special or unexpected characters.
Also affects:
src/vendor/formula-beautifier.js:164~179
Did we get this right? 👍 / 👎 to inform future reviews.
Adds comprehensive sections to the README explaining how to build, compile, and package the extension. Details the steps for creating a new release, including GitHub Actions automation for VSIX generation and upload. Also updates the minimum required VS Code version.
Adds real-time error diagnostics, function validation, and comment warnings for formulas. Implements comprehensive IntelliSense with auto-completion for functions and parameter hints. Applies an Airtable-matching color scheme for accurate syntax highlighting. Introduces v2 formatters for adaptive beautifying and safe minification, with version selection. Extends file support for minified formulas and updates configuration options. Overhauls release workflow for manual triggering, pre-releases, and publishing to multiple marketplaces. Improves CI/CD caching and dependency management.
*Total -- 887.02kb -> 692.94kb (21.88%) /packages/mcp-server/assets/architecture.png -- 276.17kb -> 171.13kb (38.04%) /packages/mcp-server/assets/banner.png -- 232.17kb -> 158.33kb (31.8%) /packages/mcp-server/assets/icon.png -- 3.50kb -> 2.98kb (14.99%) /packages/extension/images/icon.png -- 3.50kb -> 2.98kb (14.99%) /packages/extension/images/gallery-banner.png -- 371.67kb -> 357.53kb (3.81%) Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Beep boop. Your images are optimized!
Your image file size has been reduced by 22% 🎉
Details
📝 docs |
repo | 🙋🏾 issues | 🏪 marketplace
~Imgbot - Part of Optimole family